package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.AlertRule;
import com.zzyl.vo.AlertRuleVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface AlertRuleMapper {
    void add(AlertRule alertRule);

    Page<AlertRuleVo> findPageList(@Param("alertRuleName") String alertRuleName,
                                   @Param("functionName") String functionName,
                                   @Param("productKey") String productKey);

    AlertRuleVo findById(Integer id);

    void updateRule(AlertRule alertRule);

    @Delete("delete from alert_rule where id = #{id,jdbcType=BIGINT}")
    void deleteById(Integer id);

    @Update("update alert_rule set status = #{status} where id = #{id}")
    void updateStatus(Integer id, Integer status);

    List<AlertRuleVo> queryAlertRule(@Param("functionId") String functionId,
                                     @Param("iotId") String iotId,
                                     @Param("productKey") String productKey);
}
